﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data;

using DQYT.HTDZ.Model;
using DQYT.HTDZ.OracleDAL;


namespace DQYT.HTDZ.BLL
{
    public class TB_Workflow_Log_BLL
    {

        private TB_Workflow_Log_DAL dal = new TB_Workflow_Log_DAL();
        /// <summary>
        /// 添加审核流水
        /// </summary>
        /// <param name="logModel"></param>
        public bool AddWorkflowLog(TB_Workflow_Log_Model logModel)
        {
            bool success = true;
            try
            {
                dal.AddWorkflowLog(logModel);
            }
            catch (Exception ex)
            {
                success = false;
            }
            return success;
        }

        /// <summary>
        /// 退回审核流水，删除tb_fa对应数据
        /// </summary>
        /// <param name="logModel"></param>
        public bool DeleteWorkflowLog(TB_Workflow_Log_Model logModel)
        {
            bool success = true;
            try
            {
                dal.DeleteWorkflowLog(logModel);
            }
            catch (Exception ex)
            {
                success = false;
            }
            return success; 
        }


        /// <summary>
        /// 取待办
        /// </summary>
        /// <param name="userCode">用户代码</param>
        /// <param name="isLastAudit">是否为终审人员角色</param>
        /// <param name="pageSize">每页条数</param>
        /// <param name="pageIndex">页号 从1开始</param>
        /// <param name="recordCount">总条数</param>
        /// <returns></returns>
        public DataTable GetWait(string userCode, bool isLastAudit, int pageSize, int pageIndex,bool getFirst, out int recordCount)
        {
            if (isLastAudit)
                return dal.GetLastWait(pageIndex, pageSize, out recordCount);
            else
                return dal.GetDepartWait(userCode, pageIndex, pageSize,getFirst, out recordCount);
        }

        /// <summary>
        /// 取已办
        /// </summary>
        /// <param name="userCode">用户代码</param>
        /// <param name="pageIndex">页号 从1开始</param>
        /// <param name="pageSize">每页条数</param>
        /// <param name="recordCount">总条数</param>
        /// <returns></returns>
        public DataTable GetDone(string userCode, int pageIndex, int pageSize, out int recordCount)
        {
            return dal.GetDone(userCode, pageIndex, pageSize, out recordCount);
        }

        /// <summary>
        /// 取井设计方案审核流水
        /// </summary>
        /// <param name="objId">井设计方案ID</param>
        /// <returns></returns>
        public DataTable GetWorkFowLog(string objId)
        {
            return dal.GetWorkFowLog(objId);
        }
    }
}
